{*
%%%copyright%%%
 * phpMyTicket - ticket reservation system
 * Copyright (C) 2004-2005 Anna Putrino, Stanislav Chachkov. All rights reserved.
 *
 * This file is part of phpMyTicket.
 *
 * This file may be distributed and/or modified under the terms of the
 * "GNU General Public License" version 2 as published by the Free
 * Software Foundation and appearing in the file LICENSE included in
 * the packaging of this file.
 *
 * Licencees holding a valid "phpmyticket professional licence" version 1
 * may use this file in accordance with the "phpmyticket professional licence"
 * version 1 Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 *
 * The "phpmyticket professional licence" version 1 is available at
 * http://www.phpmyticket.com/ and in the file
 * PROFESSIONAL_LICENCE included in the packaging of this file.
 * For pricing of this licence please contact us via e-mail to 
 * info@phpmyticket.com.
 * Further contact information is available at http://www.phpmyticket.com/
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Contact info@phpmyticket.com if any conditions of this licencing isn't 
 * clear to you.
 
 *}
{include file="header.tpl"}
<!-- Start of massive elseif -->

{if $smarty.post.action eq "addtocart"}  
  {assign var='last_item' value=$cart->add_item_f($smarty.post.event,$smarty.post.category,$smarty.post.place,'mode_web')}
  {if $last_item}
    {include file="discount.tpl"}
  {else}
    {include file="category.tpl"}
   {/if}

{elseif $smarty.post.action eq "adddiscount"}
  {cart->set_discounts event_id=$smarty.post.event_id 
   category_id=$smarty.post.category_id item_id=$smarty.post.item_id 
   discounts=$smarty.post.discount }
  {include file="cart_view.tpl"}

{elseif $smarty.get.action eq "remove"}
  {$cart->remove_item_f($smarty.get.event_id,$smarty.get.cat_id,$smarty.get.item)}
  {include file="cart_view.tpl"}

{elseif $smarty.get.action eq "view_cart"}
  {include file="cart_view.tpl"}
  
{elseif $smarty.get.category_id}
  {if $smarty.get.qty} 
    {assign var='last_item' value=$cart->add_item_f($smarty.get.event_id,$smarty.get.category_id,$smarty.get.qty)}
    {if $last_item}
      {include file="discount.tpl"}  
    {else}
      {include file="event.tpl"}
    {/if}
  {else} 
    {include file="category.tpl"} 
  {/if}

{elseif $smarty.get.event_id}
  {include file="event.tpl"}

{elseif $smarty.get.event_group_id}
  {include file="event_group.tpl"} 

{elseif $smarty.get.event_groups}
  {include file="event_groups.tpl"} 

{elseif $smarty.get.register_user}
  {if $smarty.get.action eq 'login'}
    {user->login username=$smarty.post.username password=$smarty.post.password}
  {elseif $smarty.get.action eq 'register'}
    {if $smarty.post.submit_info}
      {user->guest data=$smarty.post}
    {elseif $smarty.post.submit_register}
      {user->member data=$smarty.post}
    {/if}
    {assign var='user_data' value=$smarty.post}
  {/if}
  {if not $user->logged}
  	{if $smarty.get.action eq 'activate'}
      {include file="activate.tpl"}
    {elseif $smarty.get.action eq 'loginerror'}
      {include file="loginerror.tpl"}
    {else}
    {include file="inscription.tpl"}
    {/if}
  {else}
    {include file="last_event_list.tpl"}
  {/if}    

{elseif $smarty.get.event_type}
  {include file="event_type.tpl"}
  
{elseif $smarty.get.personal_page}
  {if $user->logged}
  	{if $smarty.get.personal_page eq 'details'}
	  {if $smarty.get.action eq 'update'}    	
      	{if $smarty.post.submit_update}
      		{user->update_member data=$smarty.post}
        {/if}
        {assign var='user_data' value=$smarty.post}
        {if $user->logged}
        	{include file="update_user.tpl"}
        {else}
			{include file="personal_page.tpl"}
        {/if}
      {else}
	  	{include file="update_user.tpl"}
      {/if}
    {elseif $smarty.get.personal_page eq 'orders'}
    	{if $smarty.post.action eq 'order_res'}
    	  {order->res_to_order order_id=$smarty.post.order_id handling_id=$smarty.post.handling}
  		  {if $order_success}
  			{include file="personal_orders.tpl"}
  		  {else} 
			<div class='error'>Error</div>
  		  {/if}
  		{elseif $smarty.post.action eq 'reorder'}
  			{include file="personal_reorder.tpl"}
		{elseif $smarty.get.id}
    		{include file="personal_order.tpl"}
    	{else}
    		{include file="personal_orders.tpl"}
		{/if}
    {else}
		{include file="personal_page.tpl"}
    {/if}
  {else}{include file="last_event_list.tpl"}
  {/if}
  
{else}
  {include file="last_event_list.tpl"}
{/if}

<!-- End of massive Elseif -->
{include file="footer.tpl"}
